<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="ibox-content">
    <form class="form-horizontal" method="post" action="#">
      <div class="form-group text-left">
        <label class="col-sm-2 control-label">选择分类</label>
        <div class="col-sm-8">#{$type_id}# </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">产生日期</label>
        <div class="col-sm-10">
          <input name="happen_date" class="form-control datepicker" type="text"  placeholder="选择产生日期"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">金额</label>
        <div class="col-sm-8">
          <input name="money" class="form-control" type="text"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group text-left">
        <label class="col-sm-2 control-label">回款账户</label>
        <div class="col-sm-8">
          <select data-placeholder="选择回款账户..." name="bank_id" class="chosen-select bank-chosen-select" style="width: 200px;" tabindex="2">
            <option value="">请选回款账户</option>
					  #{foreach from=$bank key=k item=v}#
            		<option value="#{$v.bank_id}#" hassubinfo="true">#{$v.name}# #{$v.card}#</option>
					  #{/foreach}#
          </select>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">备注</label>
        <div class="col-sm-8">
          <textarea name="intro" class="form-control"></textarea>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-8">
          <button class="btn btn-w-m btn-info save-form" type="button">保存数据</button>
        </div>
      </div>
    </form>
  </div>
</div>
<!-- 自定义js --> 
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script> 
<script>
$(document).ready(function () {
	$(".datepicker").datepicker({
		language: "zh-CN",
		autoclose: true,//选中之后自动隐藏日期选择框
		clearBtn: true,//清除按钮
		todayBtn: false,//今日按钮
		format: "yyyy-mm-dd",
	});
	
	$('.chosen-select').chosen({search_contains: true});
	$(".chosen-select").val("#{$customer_id}#").trigger("chosen:updated");
	
	
	$("body").on("click", ".save-form", function() {
		FormData=$("form").serialize();
		$.ajax({
			type: "POST",
			url: "#{$smarty.const.ACT}#/erp/FinIncomeRecord/fin_income_record_add/",
			data:FormData,
			dataType:"json",
			success: function(data){
				if(data.statusCode=='200'){
					layer.msg('操作成功', {icon: 1}); 	
					setTimeout(function(){
						//关闭窗口
						var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
						parent.layer.close(index);
					 },800);
				}else{
					layer.msg(data.message, {icon: 5}); 		
				}
			}
		});		
	});
});
</script>
</body>
</html>